import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '节日',
    align:"center",
    dataIndex: 'holiday',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
   },
   {
    title: '节日名称',
    align:"center",
    dataIndex: 'name'
   },
  {
    title: '部门',
    align:"center",
    dataIndex: 'departid'
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: '部门',
    field: 'departid',
    component: 'JSelectDept',
    componentProps:{
      checkStrictly:false,
      multiple:false
    }
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '节日',
    field: 'holiday',
    component: 'DatePicker',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入节日!'},
          ];
     },
  },
  {
    label: '节日名称',
    field: 'name',
    component: 'Input',
  },
  {
    label: '部门',
    field: 'departid',
    component: 'JSelectDept',
    componentProps:{
      checkStrictly:false,
      multiple:false
    }
  },
  {
    label: '时段',
    field: 'timePeriod',
    required: true,
    component: 'RangeTime',
  },
  
  /*
  {
    label: '时段',
    field: 'timePeriod2',
    component: 'RadioButtonGroup',
    componentProps:{
      options:[
      {label: '全天',value :0},
      {label: '上午',value :1},
      {label: '下午',value :2}
      ],
    },
    defaultValue: 0
  },
  */
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  holiday: {title: '节日',order: 0,view: 'date', type: 'string',},
  name: {title: '节日名称',order: 1,view: 'text', type: 'string',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
